// JavaScript source code
function getsfzdata()
{
    var jo = new Object();
    jo.SQL = "SELECT * FROM lwyxt_sfzpz WHERE djsj is not null and GETDATE()>djsj";
    jo.Count = 10000000;
    var settings = {
        "async": true,
        "crossDomain": true,
        "url": rooturl + 'CommList',
        "method": "POST",
        "headers": {},
        "data": base64_encode(JSON.stringify(jo))
    };
    $.ajax(settings).done(function (response) {
        gjobj = response.data;
        kgbqk = response;

     $('.bottombar-right-value').text(gjobj.length);

        for (var key in gjobj){

            var id = gjobj[key].sftbid;
            var ph = paper.select("#" + id);
     
            if(ph!=null){
            
            var dot = ph.getPointAtLength(0);
            var tmp = paper.select("svg").image("./images/sfz4.svg", dot.x-25, dot.y-10, 50, 50);
            var datainfo=JSON.stringify(gjobj[key]);
       
            paper.select("#收费站关闭").g().add(tmp);
        
           //显示收费站窗口，鼠标移上去显示小窗口，点击显示大窗口。
            tmp.attr({"id":datainfo});
            tmp.attr({"onmouseover":"var sfzobj=JSON.parse($(this)[0].id);sfzxfck(sfzobj);scbg(sfzobj.zt,'table2')"});
            tmp.attr({"onclick":"var sfzobj=JSON.parse($(this)[0].id);zssfzxq(sfzobj);scbg(sfzobj.zt,'table2xq')"});
            tmp.attr({"onmouseout":"$('.tables').css('display','none')"})
               
                      }
        }

    })

}


//收费站移动上去的悬浮窗口
 function  sfzxfck(sfz){
        $('.tables').css('display','block');
        $('.sfzxftop').text(sfz.sfzmc);
        
        if(sfz.ms.length>45)
        {
            $('.descr').text(sfz.ms.substr(0,40)+'...');
        }
        else{
            $('.descr').text(sfz.ms);
        }
     
        if(sfz.djsj!=''&&sfz.yjhfsj==''){
             $('.descr2').css('display','block');
             $('.descr3').css('display','block');
             $('.msdjsj').text(sjjq(sfz.djsj));
             $('.descr3').text('无法预估');
        }
        if(sfz.djsj==''){
            $('.descr2').hide();
            $('.descr3').hide();
            $('.msdjsj').text(sjjq(sfz.djsj));
        }
        if(sfz.djsj!=''&&sfz.yjhfsj!=''){
                  $('.descr2').css('display','block');
                  $('.descr3').css('display','block');
                  $('.descr3').text(sjjq(sfz.yjhfsj));
                  $('.msdjsj').text(sjjq(sfz.djsj));
        }
       
         
    }


//收费站的开关
    function  scbg(str,diz){
        $('.'+diz)[0].innerHTML='';
        var sfzkg=JSON.parse(str);
        $.each(sfzkg,function(ke,va){   
        $.each(va,function(e,b){
        $.each(b,function(z,q){
        $('.'+diz).append('<tr><td class=\'enter\'>'+e+'</td><td colspan=\'2\'>'+z+'</td><td><img class=\'tableimg\' src=\"./images/open.png\" alt=\"Pulpit rock\" ><span class=\'crktext\'>'+q+'</span></td></tr>');
                                      });
                                       });
               });
        $.each($('.crktext'),function(e,v){
        if(v.innerHTML==0){
             v.previousSibling.src='./images/close.png';
             v.innerHTML='关闭';
        }
        if(v.innerHTML==1){
             v.previousSibling.src='./images/open.png';
             v.innerHTML='开启';
           }
        });
        
        $('.tables').css('top',mousey-100);
        $('.tables').css('left',mousex+10);
             }
  var mousex;
  var mousey;
   window.onmousemove=function(e){
        mousey=e.clientY;
        mousex=e.clientX;
        
   }
          
        
 //收费站图标点击窗口
   

